home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 October / Gamestar_77_2005-10_dvd.iso / Dema / betonsoldier_spdemo.exe / {app} / Shaders / KT_PostProcess_Common.fx < prev    next >
Encoding:
Text File  |  2005-05-05  |  20.1 KB  |  660 lines

  1. //------------------------------------------------------------------------------------------------------
  2. //------------------------------------------------------------------------------------------------------
  3. //------------------------------------------------------------------------------------------------------
  4.  
  5. #include "shared.fx"
  6.  
  7. //------------------------------------------------------------------------------------------------------
  8. //- Static parameters
  9. //------------------------------------------------------------------------------------------------------
  10.  
  11. //common things
  12. shared texture SourceTexture1;
  13. shared texture SourceTexture2;
  14. shared texture SourceTexture3;
  15. shared texture SourceTexture4;
  16.  
  17. shared float TextureWidth1;
  18. shared float TextureWidth2;
  19. shared float TextureWidth3;
  20. shared float TextureWidth4;
  21.  
  22. shared float TextureHeight1;
  23. shared float TextureHeight2;
  24. shared float TextureHeight3;
  25. shared float TextureHeight4;
  26.  
  27. shared float4 BlendWeight1;
  28. shared float4 BlendWeight2;
  29. shared float4 BlendWeight3;
  30. shared float4 BlendWeight4;
  31.  
  32. shared float NeighbourSamplingOffsetU;
  33. shared float NeighbourSamplingOffsetV;
  34.  
  35.  
  36. //------------------------------------------------------------------------------------------------------
  37. //------------------------------------------------------------------------------------------------------
  38. //------------------------------------------------------------------------------------------------------
  39.  
  40. struct VS_PostProcess_Input
  41. {
  42.     float4    Position    :    POSITION;
  43.     float2    DiffuseUv    :    TEXCOORD0;    
  44. };
  45.  
  46. //------------------------------------------------------------------------------------------------------
  47.  
  48. struct VS_PostProcess_Output1
  49. {
  50.     float4    Position    :    POSITION;
  51.     float2    DiffuseUv    :    TEXCOORD0;    
  52. };
  53.  
  54. //------------------------------------------------------------------------------------------------------
  55.  
  56. struct VS_PostProcess_Output2
  57. {
  58.     float4    Position        : POSITION;
  59.     float2    DiffuseUv1        : TEXCOORD0;
  60.     float2    DiffuseUv2        : TEXCOORD1;
  61. };
  62.  
  63. //------------------------------------------------------------------------------------------------------
  64.  
  65. struct VS_PostProcess_Output3
  66. {
  67.     float4    Position        : POSITION;
  68.     float2    DiffuseUv1        : TEXCOORD0;
  69.     float2    DiffuseUv2        : TEXCOORD1;
  70.     float2    DiffuseUv3        : TEXCOORD2;
  71. };
  72.  
  73. //------------------------------------------------------------------------------------------------------
  74.  
  75. struct VS_PostProcess_Output4
  76. {
  77.     float4    Position        : POSITION;
  78.     float2    DiffuseUv1        : TEXCOORD0;
  79.     float2    DiffuseUv2        : TEXCOORD1;
  80.     float2    DiffuseUv3        : TEXCOORD2;
  81.     float2    DiffuseUv4        : TEXCOORD3;    
  82. };
  83.  
  84. //------------------------------------------------------------------------------------------------------
  85.  
  86. struct VS_PostProcess_Output_NeighbourSampling
  87. {
  88.     float4    Position    :    POSITION;
  89.     float2    DiffuseN0    :    TEXCOORD0;
  90.     float2    DiffuseN1    :    TEXCOORD1;
  91.     float2    DiffuseN2    :    TEXCOORD2;
  92.     float2    DiffuseN3    :    TEXCOORD3;
  93. };
  94.  
  95. //------------------------------------------------------------------------------------------------------
  96. //                                        VERTEX SHADERS DECLARATIONS
  97. //------------------------------------------------------------------------------------------------------
  98. VS_PostProcess_Output1                    VSBase(const VS_PostProcess_Input input);
  99.  
  100. VS_PostProcess_Output1                    VSBaseScreenCorrected1(const VS_PostProcess_Input input);
  101. VS_PostProcess_Output2                    VSBaseScreenCorrected2(const VS_PostProcess_Input input);
  102. VS_PostProcess_Output3                    VSBaseScreenCorrected3(const VS_PostProcess_Input input);
  103. VS_PostProcess_Output4                    VSBaseScreenCorrected4(const VS_PostProcess_Input input);
  104.  
  105. VS_PostProcess_Output_NeighbourSampling    VSNeighbourSamplingCross(const VS_PostProcess_Input input);
  106. VS_PostProcess_Output_NeighbourSampling    VSNeighbourSamplingBox(const VS_PostProcess_Input input);
  107. VS_PostProcess_Output_NeighbourSampling    VSNeighbourSamplingLine(const VS_PostProcess_Input input);
  108. VS_PostProcess_Output_NeighbourSampling    VSNeighbourSamplingColumn(const VS_PostProcess_Input input);
  109.  
  110. //------------------------------------------------------------------------------------------------------
  111. //                                        VERTEX SHADERS IMPLEMENTATIONS
  112. //------------------------------------------------------------------------------------------------------
  113.  
  114. //------------------------------------------------------------------------------------------------------
  115. // VS_PostProcess_Output1 VSBase(const VS_PostProcess_Input input);
  116. //
  117. // simple position + uv transfer (UV correction is applied though)
  118. //------------------------------------------------------------------------------------------------------
  119. VS_PostProcess_Output1 VSBase(const VS_PostProcess_Input input)
  120. {
  121.     VS_PostProcess_Output1 output;
  122.     
  123.     // output position into world+view+projection space
  124.     output.Position = input.Position;
  125.         
  126.     // Diffuse Uv output
  127.     output.DiffuseUv = input.DiffuseUv;
  128.         
  129.     return output;
  130. }
  131.  
  132.  
  133. //------------------------------------------------------------------------------------------------------
  134. // VS_PostProcess_Output1 VSBaseScreenCorrected1(const VS_PostProcess_Input input);
  135. //
  136. // simple position + uv transfer (UV correction is applied though)
  137. //------------------------------------------------------------------------------------------------------
  138. VS_PostProcess_Output1 VSBaseScreenCorrected1(const VS_PostProcess_Input input)
  139. {
  140.     VS_PostProcess_Output1 output;
  141.     
  142.     // output position into world+view+projection space
  143.     output.Position = input.Position;
  144.         
  145.     // Diffuse Uv output
  146.     output.DiffuseUv = input.DiffuseUv + (0.5f/TextureWidth1, 0.5f/TextureHeight1);
  147.         
  148.     return output;
  149. }
  150.  
  151. //------------------------------------------------------------------------------------------------------
  152. // VS_PostProcess_Output2 VSBaseScreenCorrected2(const VS_PostProcess_Input input);
  153. //
  154. // simple position + uv transfer (UV correction is applied though)
  155. //------------------------------------------------------------------------------------------------------
  156. VS_PostProcess_Output2 VSBaseScreenCorrected2(const VS_PostProcess_Input input)
  157. {
  158.     VS_PostProcess_Output2 output;
  159.     
  160.     // output position into world+view+projection space
  161.     output.Position = input.Position;
  162.         
  163.     // Diffuse Uv output
  164.     output.DiffuseUv1 = input.DiffuseUv + (0.5f/TextureWidth1, 0.5f/TextureHeight1);
  165.     output.DiffuseUv2 = input.DiffuseUv + (0.5f/TextureWidth2, 0.5f/TextureHeight2);
  166.         
  167.     return output;
  168. }
  169.  
  170. //------------------------------------------------------------------------------------------------------
  171. // VS_PostProcess_Output3 VSBaseScreenCorrected3(const VS_PostProcess_Input input);
  172. //
  173. // simple position + uv transfer (UV correction is applied though)
  174. //------------------------------------------------------------------------------------------------------
  175. VS_PostProcess_Output3 VSBaseScreenCorrected3(const VS_PostProcess_Input input)
  176. {
  177.     VS_PostProcess_Output3 output;
  178.     
  179.     // output position into world+view+projection space
  180.     output.Position = input.Position;
  181.         
  182.     // Diffuse Uv output
  183.     output.DiffuseUv1 = input.DiffuseUv + (0.5f/TextureWidth1, 0.5f/TextureHeight1);
  184.     output.DiffuseUv2 = input.DiffuseUv + (0.5f/TextureWidth2, 0.5f/TextureHeight2);
  185.     output.DiffuseUv3 = input.DiffuseUv + (0.5f/TextureWidth3, 0.5f/TextureHeight3);
  186.         
  187.     return output;
  188. }
  189.  
  190. //------------------------------------------------------------------------------------------------------
  191. // VS_PostProcess_Output4 VSBaseScreenCorrected4(const VS_PostProcess_Input input);
  192. //
  193. // simple position + uv transfer (UV correction is applied though)
  194. //------------------------------------------------------------------------------------------------------
  195. VS_PostProcess_Output4 VSBaseScreenCorrected4(const VS_PostProcess_Input input)
  196. {
  197.     VS_PostProcess_Output4 output;
  198.     
  199.     // output position into world+view+projection space
  200.     output.Position = input.Position;
  201.         
  202.     // Diffuse Uv output
  203.     output.DiffuseUv1 = input.DiffuseUv + (0.5f/TextureWidth1, 0.5f/TextureHeight1);
  204.     output.DiffuseUv2 = input.DiffuseUv + (0.5f/TextureWidth2, 0.5f/TextureHeight2);
  205.     output.DiffuseUv3 = input.DiffuseUv + (0.5f/TextureWidth3, 0.5f/TextureHeight3);
  206.     output.DiffuseUv4 = input.DiffuseUv + (0.5f/TextureWidth4, 0.5f/TextureHeight4);    
  207.         
  208.     return output;
  209. }
  210.  
  211.  
  212. //------------------------------------------------------------------------------------------------------
  213. // VS_PostProcess_Output_NeighbourSampling    VSNeighbourSampling(const VS_PostProcess_Input input)
  214. //                    0X0
  215. // cross sampling    X0X (X are samples)
  216. //                    0X0
  217. //------------------------------------------------------------------------------------------------------
  218. VS_PostProcess_Output_NeighbourSampling VSNeighbourSamplingCross(const VS_PostProcess_Input input)
  219. {
  220.     VS_PostProcess_Output_NeighbourSampling output;
  221.     
  222.     // output position into world+view+projection space
  223.     output.Position = input.Position;
  224.  
  225.     // Diffuse Uv output using neighbour sampling!!        
  226.     float OffsetU = NeighbourSamplingOffsetU/TextureWidth1;
  227.     float OffsetV = NeighbourSamplingOffsetV/TextureHeight1;
  228.     
  229.     output.DiffuseN0 = saturate(input.DiffuseUv + float2(-OffsetU,0.0f)); // left
  230.     output.DiffuseN1 = saturate(input.DiffuseUv + float2(+OffsetU,0.0f)); // right
  231.     output.DiffuseN2 = saturate(input.DiffuseUv + float2(0.0f,+OffsetV)); // up
  232.     output.DiffuseN3 = saturate(input.DiffuseUv + float2(0.0f,-OffsetV)); // down
  233.     
  234.     return output;
  235. }
  236.  
  237.  
  238. //------------------------------------------------------------------------------------------------------
  239. // VS_PostProcess_Output_NeighbourSampling    VSNeighbourSamplingBox(const VS_PostProcess_Input input)
  240. //                    X0X
  241. // box sampling        000 (X are samples)
  242. //                    X0X
  243. //------------------------------------------------------------------------------------------------------
  244. VS_PostProcess_Output_NeighbourSampling VSNeighbourSamplingBox(const VS_PostProcess_Input input)
  245. {
  246.     VS_PostProcess_Output_NeighbourSampling output;
  247.     
  248.     output.Position = input.Position;
  249.  
  250.     float OffsetU = NeighbourSamplingOffsetU/TextureWidth1;
  251.     float OffsetV = NeighbourSamplingOffsetV/TextureHeight1;
  252.     
  253.     output.DiffuseN0 = saturate(input.DiffuseUv + float2(-OffsetU,+OffsetV)); // top left
  254.     output.DiffuseN1 = saturate(input.DiffuseUv + float2(+OffsetU,+OffsetV)); // top right
  255.     output.DiffuseN2 = saturate(input.DiffuseUv + float2(-OffsetU,-OffsetV)); // bottom left
  256.     output.DiffuseN3 = saturate(input.DiffuseUv + float2(+OffsetU,-OffsetV)); // bottom right
  257.     
  258.     return output;
  259. }
  260.  
  261.  
  262. //------------------------------------------------------------------------------------------------------
  263. // VS_PostProcess_Output_NeighbourSampling    VSNeighbourSamplingLine(const VS_PostProcess_Input input)
  264. //
  265. // line sampling    XX0XX (X are samples)
  266. //
  267. //------------------------------------------------------------------------------------------------------
  268. VS_PostProcess_Output_NeighbourSampling VSNeighbourSamplingLine(const VS_PostProcess_Input input)
  269. {
  270.     VS_PostProcess_Output_NeighbourSampling output;
  271.     
  272.     output.Position = input.Position;
  273.  
  274.     float2 OffsetNear = float2(NeighbourSamplingOffsetU/TextureWidth1, 0.0f);
  275.     float2 OffsetFar  = 2.0f*OffsetNear;
  276.     
  277.     output.DiffuseN0 = saturate(input.DiffuseUv - OffsetFar);
  278.     output.DiffuseN1 = saturate(input.DiffuseUv - OffsetNear);
  279.     output.DiffuseN2 = saturate(input.DiffuseUv + OffsetNear);
  280.     output.DiffuseN3 = saturate(input.DiffuseUv + OffsetFar);
  281.         
  282.     return output;
  283. }
  284.  
  285.  
  286. //------------------------------------------------------------------------------------------------------
  287. // VS_PostProcess_Output_NeighbourSampling    VSNeighbourSamplingColumn(const VS_PostProcess_Input input)
  288. //                    X
  289. //                    X 
  290. // column sampling    0 (X are samples)
  291. //                    X
  292. //                    X
  293. //------------------------------------------------------------------------------------------------------
  294. VS_PostProcess_Output_NeighbourSampling VSNeighbourSamplingColumn(const VS_PostProcess_Input input)
  295. {
  296.     VS_PostProcess_Output_NeighbourSampling output;
  297.     
  298.     output.Position = input.Position;
  299.  
  300.     float2 OffsetNear = float2(0.0f, NeighbourSamplingOffsetV/TextureHeight1);
  301.     float2 OffsetFar  = 2.0f*OffsetNear;
  302.     
  303.     output.DiffuseN0 = saturate(input.DiffuseUv - OffsetFar);
  304.     output.DiffuseN1 = saturate(input.DiffuseUv - OffsetNear);
  305.     output.DiffuseN2 = saturate(input.DiffuseUv + OffsetNear);
  306.     output.DiffuseN3 = saturate(input.DiffuseUv + OffsetFar);
  307.         
  308.     return output;
  309. }
  310.  
  311.  
  312. //------------------------------------------------------------------------------------------------------
  313. //                                            TECHNIQUES DEFINITIONS
  314. //------------------------------------------------------------------------------------------------------
  315.  
  316.  
  317. //----------------------------------------------
  318. // simple output to screen of SourceTexture1
  319. //----------------------------------------------
  320. technique BaseRender
  321. <
  322.     int Priority = 1;
  323.     int TechniqueIndex = 100;
  324.     int DeviceType = HWSHADER_ONLY;
  325.     int LightingType = INTEGRATED_LIGHTING;
  326.     string RenderingType = "Standard";
  327. >
  328. {
  329.     pass pass1
  330.     {
  331.         Texture[0]            = <SourceTexture1>;
  332.         MinFilter[0]        = LINEAR;
  333.         MagFilter[0]        = LINEAR;
  334.         MipFilter[0]        = NONE; //no mipmaps.
  335.         AddressU[0]            = CLAMP;
  336.         AddressV[0]            = CLAMP;
  337.         AlphaBlendEnable    = false;
  338.         AlphaTestEnable        = false;
  339.         FogEnable            = false;
  340.         
  341.         CullMode            = NONE;
  342.         ZEnable                = false;
  343.         ZWriteEnable        = false;
  344.         
  345.         VertexShader = compile vs_1_1 VSBase();
  346.         
  347.         PixelShader = 
  348.         asm
  349.         {
  350.             ps_1_1    
  351.                             
  352.             tex        t0    // source texture
  353.                         
  354.             mov r0, t0    // simple output
  355.         };
  356.     }
  357. }
  358.  
  359. //------------------------------------------------------------------------------------------------------
  360. //------------------------------------------------------------------------------------------------------
  361. //------------------------------------------------------------------------------------------------------
  362.  
  363.  
  364. //----------------------------------------------
  365. // Additive blend of SourceTexture1 with BlendWeight1 with current RT
  366. //----------------------------------------------
  367. technique AdditiveBlendWithCurrentRT
  368. <
  369.     int Priority = 1;
  370.     int TechniqueIndex = 101;
  371.     int DeviceType = HWSHADER_ONLY;
  372.     int LightingType = INTEGRATED_LIGHTING;
  373.     string RenderingType = "Standard";
  374. >
  375. {
  376.     pass pass1
  377.     {
  378.         Texture[0]            = <SourceTexture1>;
  379.         MinFilter[0]        = LINEAR;
  380.         MagFilter[0]        = LINEAR;
  381.         MipFilter[0]        = NONE; //no mipmaps.
  382.         AddressU[0]            = CLAMP;
  383.         AddressV[0]            = CLAMP;
  384.         AlphaBlendEnable    = true;
  385.         SrcBlend            = ONE;
  386.         DestBlend            = ONE;
  387.         AlphaTestEnable        = false;
  388.         FogEnable            = false;
  389.         
  390.         CullMode            = NONE;
  391.         ZEnable                = false;
  392.         ZWriteEnable        = false;
  393.         
  394.         VertexShader = compile vs_1_1 VSBase();
  395.         
  396.         PixelShaderConstant[0] = <BlendWeight1>;
  397.         
  398.         PixelShader = 
  399.         asm
  400.         {
  401.             ps_1_1                
  402.                             
  403.             tex        t0    // source texture
  404.                         
  405.             mul r0, c0, t0
  406.         };
  407.     }
  408. }
  409.  
  410.  
  411. //----------------------------------------------
  412. // Alpha blend of SourceTexture1 with blend factor BlendWeight1 with current RT content
  413. //----------------------------------------------
  414. technique AlphaBlendWithCurrentRT
  415. <
  416.     int Priority = 1;
  417.     int TechniqueIndex = 102;
  418.     int DeviceType = HWSHADER_ONLY;
  419.     int LightingType = INTEGRATED_LIGHTING;
  420.     string RenderingType = "Standard";
  421. >
  422. {
  423.     pass pass1
  424.     {
  425.         Texture[0]            = <SourceTexture1>;
  426.         MinFilter[0]        = LINEAR;
  427.         MagFilter[0]        = LINEAR;
  428.         MipFilter[0]        = NONE; //no mipmaps.
  429.         AddressU[0]            = CLAMP;
  430.         AddressV[0]            = CLAMP;
  431.         AlphaBlendEnable    = true;
  432.         SrcBlend            = SRCALPHA;
  433.         DestBlend            = INVSRCALPHA;
  434.         AlphaTestEnable        = false;
  435.         FogEnable            = false;
  436.         
  437.         CullMode            = NONE;
  438.         ZEnable                = false;
  439.         ZWriteEnable        = false;
  440.         
  441.         VertexShader = compile vs_1_1 VSBase();
  442.         
  443.         PixelShaderConstant[0] = <BlendWeight1>;
  444.         
  445.         PixelShader = 
  446.         asm
  447.         {
  448.             ps_1_1                
  449.                             
  450.             tex        t0    // source texture
  451.                         
  452.             mov r0.rgb, t0 + mul r0.a, t0, c0
  453.         };
  454.     }
  455. }
  456.  
  457.  
  458.  
  459. //----------------------------------------------
  460. // blend of 2 textures into one
  461. //----------------------------------------------
  462. technique Blend2
  463. <
  464.     int Priority = 1;
  465.     int TechniqueIndex = 200;
  466.     int DeviceType = HWSHADER_ONLY;
  467.     int LightingType = INTEGRATED_LIGHTING;
  468.     string RenderingType = "Standard";
  469. >
  470. {
  471.     pass pass1
  472.     {
  473.         Texture[0]            = <SourceTexture1>;
  474.         MinFilter[0]        = LINEAR;
  475.         MagFilter[0]        = LINEAR;
  476.         MipFilter[0]        = NONE; //no mipmaps.
  477.         AddressU[0]            = CLAMP;
  478.         AddressV[0]            = CLAMP;
  479.         
  480.         Texture[1]            = <SourceTexture2>;
  481.         MinFilter[1]        = LINEAR;
  482.         MagFilter[1]        = LINEAR;
  483.         MipFilter[1]        = NONE; //no mipmaps.
  484.         AddressU[1]            = CLAMP;
  485.         AddressV[1]            = CLAMP;
  486.         
  487.         AlphaBlendEnable    = false;
  488.         AlphaTestEnable        = false;
  489.         FogEnable            = false;
  490.         
  491.         CullMode            = NONE;
  492.         ZEnable                = false;
  493.         ZWriteEnable        = false;
  494.         
  495.         VertexShader = compile vs_1_1 VSBaseScreenCorrected2();
  496.         
  497.         PixelShaderConstant[0] = <BlendWeight1>;
  498.         PixelShaderConstant[1] = <BlendWeight2>;
  499.         
  500.         PixelShader = 
  501.         asm
  502.         {
  503.             ps_1_1                
  504.                             
  505.             tex        t0
  506.             tex        t1
  507.             
  508.             mul r0, c0, t0
  509.             mad r0, c1, t1, r0
  510.         };
  511.     }
  512. }
  513.  
  514.  
  515. //----------------------------------------------
  516. // blend of 3 textures into one
  517. //----------------------------------------------
  518. technique Blend3
  519. <
  520.     int Priority = 1;
  521.     int TechniqueIndex = 201;
  522.     int DeviceType = HWSHADER_ONLY;
  523.     int LightingType = INTEGRATED_LIGHTING;
  524.     string RenderingType = "Standard";
  525. >
  526. {
  527.     pass pass1
  528.     {
  529.         Texture[0]            = <SourceTexture1>;
  530.         MinFilter[0]        = LINEAR;
  531.         MagFilter[0]        = LINEAR;
  532.         MipFilter[0]        = NONE; //no mipmaps.
  533.         AddressU[0]            = CLAMP;
  534.         AddressV[0]            = CLAMP;
  535.         
  536.         Texture[1]            = <SourceTexture2>;
  537.         MinFilter[1]        = LINEAR;
  538.         MagFilter[1]        = LINEAR;
  539.         MipFilter[1]        = NONE; //no mipmaps.
  540.         AddressU[1]            = CLAMP;
  541.         AddressV[1]            = CLAMP;
  542.         
  543.         Texture[2]            = <SourceTexture3>;
  544.         MinFilter[2]        = LINEAR;
  545.         MagFilter[2]        = LINEAR;
  546.         MipFilter[2]        = NONE; //no mipmaps.
  547.         AddressU[2]            = CLAMP;
  548.         AddressV[2]            = CLAMP;
  549.         
  550.         AlphaBlendEnable    = false;
  551.         AlphaTestEnable        = false;
  552.         FogEnable            = false;
  553.         
  554.         CullMode            = NONE;
  555.         ZEnable                = false;
  556.         ZWriteEnable        = false;
  557.         
  558.         VertexShader = compile vs_1_1 VSBaseScreenCorrected3();
  559.         
  560.         PixelShaderConstant[0] = <BlendWeight1>;
  561.         PixelShaderConstant[1] = <BlendWeight2>;
  562.         PixelShaderConstant[2] = <BlendWeight3>;
  563.         
  564.         PixelShader = 
  565.         asm
  566.         {
  567.             ps_1_1                
  568.                             
  569.             tex        t0
  570.             tex        t1
  571.             tex        t2
  572.             
  573.             mul r0, c0, t0
  574.             mad r0, c1, t1, r0
  575.             mad r0, c2, t2, r0
  576.         };
  577.     }
  578. }
  579.  
  580.  
  581. //----------------------------------------------
  582. // blend of 4 textures into one
  583. //----------------------------------------------
  584. technique Blend4
  585. <
  586.     int Priority = 1;
  587.     int TechniqueIndex = 202;
  588.     int DeviceType = HWSHADER_ONLY;
  589.     int LightingType = INTEGRATED_LIGHTING;
  590.     string RenderingType = "Standard";
  591. >
  592. {
  593.     pass pass1
  594.     {
  595.         Texture[0]            = <SourceTexture1>;
  596.         MinFilter[0]        = LINEAR;
  597.         MagFilter[0]        = LINEAR;
  598.         MipFilter[0]        = NONE; //no mipmaps.
  599.         AddressU[0]            = CLAMP;
  600.         AddressV[0]            = CLAMP;
  601.         
  602.         Texture[1]            = <SourceTexture2>;
  603.         MinFilter[1]        = LINEAR;
  604.         MagFilter[1]        = LINEAR;
  605.         MipFilter[1]        = NONE; //no mipmaps.
  606.         AddressU[1]            = CLAMP;
  607.         AddressV[1]            = CLAMP;
  608.         
  609.         Texture[2]            = <SourceTexture3>;
  610.         MinFilter[2]        = LINEAR;
  611.         MagFilter[2]        = LINEAR;
  612.         MipFilter[2]        = NONE; //no mipmaps.
  613.         AddressU[2]            = CLAMP;
  614.         AddressV[2]            = CLAMP;
  615.         
  616.         Texture[3]            = <SourceTexture4>;
  617.         MinFilter[3]        = LINEAR;
  618.         MagFilter[3]        = LINEAR;
  619.         MipFilter[3]        = NONE; //no mipmaps.
  620.         AddressU[3]            = CLAMP;
  621.         AddressV[3]            = CLAMP;
  622.         
  623.         AlphaBlendEnable    = false;
  624.         AlphaTestEnable        = false;
  625.         FogEnable            = false;
  626.         
  627.         CullMode            = NONE;
  628.         ZEnable                = false;
  629.         ZWriteEnable        = false;
  630.         
  631.         VertexShader = compile vs_1_1 VSBaseScreenCorrected4();
  632.         
  633.         PixelShaderConstant[0] = <BlendWeight1>;
  634.         PixelShaderConstant[1] = <BlendWeight2>;
  635.         PixelShaderConstant[2] = <BlendWeight3>;
  636.         PixelShaderConstant[3] = <BlendWeight4>;
  637.         
  638.         PixelShader = 
  639.         asm
  640.         {
  641.             ps_1_1                
  642.                             
  643.             tex        t0
  644.             tex        t1
  645.             tex        t2
  646.             tex        t3
  647.             
  648.             mul r0, c0, t0
  649.             mad r0, c1, t1, r0
  650.             mad r0, c2, t2, r0
  651.             mad r0, c3, t3, r0
  652.         };
  653.     }
  654. }
  655.  
  656.  
  657. //------------------------------------------------------------------------------------------------------
  658. //------------------------------------------------------------------------------------------------------
  659. //------------------------------------------------------------------------------------------------------
  660.